// Exceptions that can occur in the CUDA Manager

using namespace System;

namespace GRIP
{
	namespace Cuda
	{
		// No CUDA devices were found
		public ref class NoCudaDevicesException : public Exception
		{
		public:
			NoCudaDevicesException();
			~NoCudaDevicesException();
		};

		// Unsupported compute version, probably newer than this program
		public ref class UnsupportedComputeVersionException : public Exception
		{
		public:
			UnsupportedComputeVersionException(int major, int minor);
			~UnsupportedComputeVersionException();

			String^ Version();
		private:
			String^ version;
		};

		// Exceptions relating to Cuda
		public ref class CudaException : public Exception
		{
		public:
			CudaException(cudaError_t error, String^ message);
			CudaException(CUresult error, String^ message);
			CudaException(int error, String^ message);
			~CudaException();
			const int Error();

		private:
			String^ CudaException::GetErrorMessage(cudaError_t error);
			String^ CudaException::GetErrorMessage(CUresult error);
			String^ CudaException::GetErrorMessage(int error);
			int error;
		};

		// Exceptions relating to DirectX
		public ref class DirectXException : public Exception
		{
		public:
			DirectXException(HRESULT result, String^ message);
			~DirectXException();

			const HRESULT Error();

		private:
			String^ GetErrorMessage(HRESULT result);
			HRESULT error;
		};
	}
}